#ifndef TreeNode_H
#define TreeNode_H

#include <QtGui>
#include "ConstraintAttribute.h"

namespace XpsAssets
{
	class TreeNode
	{

	public:

		enum NodeType 
		{
			QUESTION,
			CONSTRAINT,
			END,
			START,
			LINK
		};

		NodeType _type;
		int _id;
		int _refId;
		int _child;
		int _parent;
		int _mode;
		QPoint _position;

		TreeNode(int id, NodeType type, QPoint position, int refId = -1)
		{
			_position = position;
			_refId = refId;
			_id = id;
			_type = type;
			_child = -1;
			_parent = -1;
			_mode = 0;
		}

		QString typeString()
		{
			switch (_type)
			{
			case QUESTION:
				return "question";
				break;

			case CONSTRAINT: 
				return "constraint";
				break;

			case END:
				return "end";
				break;

			case START:
				return "start";
				break;

			case LINK: 
				return "link"; 
				break;
			}

			return "";
		}
	};

	class ConstraintNode : public TreeNode
	{
	public:
		int _false;
		int _true;
		QMap<int, XpsAssets::ConstraintAttribute*> attributes;

		ConstraintNode(int id, QPoint position) : TreeNode(id, TreeNode::CONSTRAINT, position, -1)
		{
			_false = 0;
			_true = 0;
		}
	};
}
#endif